package demo.practice.sort;

import java.util.ArrayList;
import java.util.Collections;

public class Offer45 {


    public String minNumber(int[] nums) {
        if (nums == null || nums.length == 0) {
            return new String();
        }

        ArrayList list = new ArrayList();
        for (int num : nums) {
            list.add(num);
        }
        Collections.sort(list, (o1, o2) -> {
           /* char[] chars = o2.toString().toCharArray();
            char[] chars1 = o1.toString().toCharArray();

            for(int i=0;i<)*/

            return (o2+""+o1).compareTo(o1+""+o2);

            //return o2.toString().toCharArray()[0] - o1.toString().toCharArray()[0];
        });

        StringBuffer sb = new StringBuffer();
        for (Object o : list) {
            sb.append(o);
        }

        return sb.toString();
    }


}
